/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.munif.util;

import br.com.munif.util.ConverterGenerico;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.convert.Converter;

/**
 *
 * @author Munif
 */
@SessionScoped
@ManagedBean
public class SistemaControlador {

    public Converter converter(String classe) {
        try {
            return new ConverterGenerico(Class.forName(classe));
        } catch (ClassNotFoundException ex) {
            ex.printStackTrace();
        }
        return null;
    }

    public List lista(String classe) {
        try {
            return CrudFacade.getInstance().listarTodos(Class.forName(classe));
        } catch (ClassNotFoundException ex) {
            ex.printStackTrace();
        }
        return null;
    }

    public List lista(String classe,String ordernadoPor) {
        try {
            return CrudFacade.getInstance().listarTodos(Class.forName(classe),ordernadoPor);
        } catch (ClassNotFoundException ex) {
            ex.printStackTrace();
        }
        return null;
    }
}
